package com.keqing.controller;

import com.ganyu.domain.ResponseResult;
import com.ganyu.domain.entity.Menu;
import com.ganyu.domain.entity.User;

import com.ganyu.domain.vo.AdminUserInfoVo;
import com.ganyu.domain.vo.RoutersVo;
import com.ganyu.service.impl.AdminLoginServiceImpl;
import com.ganyu.service.impl.MenuServiceImpl;
import com.ganyu.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * DATA: 2022/9/15
 * Author: 晨夕
 */
@RestController
@RequestMapping
public class AdminLoginController {

    @Autowired
    private AdminLoginServiceImpl adminLoginServiceImpl;

    @Autowired
    private MenuServiceImpl menuServiceImpl;

    //登录接口
    @PostMapping("/user/login")
    public ResponseResult<User> login(@RequestBody User user){
        return adminLoginServiceImpl.login(user);
    }

    //获取用户菜单、角色名、个人信息
    @GetMapping("/getInfo")
    public ResponseResult<AdminUserInfoVo> getUserInfo(){
        return adminLoginServiceImpl.getUserInfo();
    }

    //获取路由
    @GetMapping("/getRouters")
    public ResponseResult<RoutersVo> getRouters(){
        return adminLoginServiceImpl.getRouters();
    }

    //退出接口
    @PostMapping("/user/logout")
    public ResponseResult logout(){
        return adminLoginServiceImpl.logout();
    }

}
